home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / GameKit / Apps / HighScoreEditor / HighScoreEditor.m < prev    next >
Text File  |  1995-06-12  |  1KB  |  59 lines

  1.  
  2. #import "HighScoreEditor.h"
  3. #import "EditingHSController.h"
  4.  
  5. @implementation HighScoreEditor
  6.  
  7. - init
  8. {
  9.     connected = NO;
  10.     return self;
  11. }
  12.  
  13. - connectToggle:sender
  14. {
  15.     if (connected) [self disconnect:sender];
  16.     else [self connect:sender];
  17.     return self;
  18. }
  19.  
  20. - disconnect:sender
  21. {
  22.     [highScoreController setLocalScores:YES];
  23.     connected = NO;
  24.     [connectWindow setTitle:[stringTable
  25.             valueForStringKey:"DisconnectedTitle"]];
  26.     [connectButton setTitle:[stringTable valueForStringKey:"Connect"]];
  27.     return self;
  28. }
  29.  
  30. - connect:sender
  31. {
  32.     [highScoreController setServerHost:[serverNameText stringValue]];
  33.     [highScoreController setGameName:[gameNameText stringValue]];
  34.     [highScoreController setLocalScores:NO];
  35.     [highScoreController readHighScores];
  36.     [highScoreController displayHighScores:self];
  37.     connected = ![highScoreController localScores];
  38.     if (!connected) return self;
  39.     [connectWindow setTitle:[stringTable
  40.             valueForStringKey:"ConnectedTitle"]];
  41.     [connectButton setTitle:[stringTable valueForStringKey:"Disconnect"]];
  42.     return self;
  43. }
  44.  
  45. - appDidInit:sender
  46. {
  47.     return self;
  48. }
  49.  
  50. - appWillTerminate:sender
  51. {
  52.     // don't leave open connections hanging around; shut down cleanly.
  53.     if (connected) [self disconnect:self];
  54.     return self;
  55. }
  56.  
  57.  
  58. @end
  59.